package control;

import calculator.Calculator;

/**
 * @author ouweijian
 * @date 2023/2/11 17:08
 */
public class UndoControl implements Control {

    private Calculator calculator;

    public UndoControl(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public void control() {
        if (!calculator.getInputDeque().isEmpty()) {
            calculator.getDeleteStack().push(calculator.getInputDeque().removeLast());
        }
    }
}
